Since Gradle 4.6:
new configurations were added: api
(only in java-library
plugin) & implementation
(defined by both).
In multi-module project I have several "core" modules that act as internal libraries and sometimes need to pass exposed compile time dependencies via api
configuration.
Previously we applied java
plugin recursively:
subprojects {
apply plugin: 'java'
}
To be purist we can apply java-library
plugin to "library" modules and java
plugin to "end-application" modules.
What if we just put:
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
}
NOTE With proper naming schema (we don't have one) it is possible to do selectively:
subprojects {
if (project.name.startsWith('lib-')) {
apply plugin: 'java-library'
} else {
apply plugin: 'java'
}
}
Copyright Notice:Content Author:「gavenkoa」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/54620695/gradle-4-6-using-java-library-java-plugins-simultaneously-in-multi-module-b